<!DOCTYPE html>
<html>
<head>
		<meta charset="UTF-8">
		<title>公告添加与修改-后台管理系统</title>
		<link rel="stylesheet" href="${rc.contextPath}/bootstrap/css/bootstrap.css" />
		<link rel="stylesheet" href="${rc.contextPath}/zui/css/zui.css" />
		<script type="text/javascript" src="${rc.contextPath}/js/jquery.1.10.1.min.js"></script>
		<script type="text/javascript" src="${rc.contextPath}/zui/js/zui.js"></script>
		
		<script type="text/javascript" charset="utf-8" src="${rc.contextPath}/ueditor/ueditor.config.js"></script>
	    <script type="text/javascript" charset="utf-8" src="${rc.contextPath}/ueditor/ueditor.all.min.js"> </script>
	    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
	    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	    <script type="text/javascript" charset="utf-8" src="${rc.contextPath}/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
		<ul class="nav nav-tabs" id="adminTab">
			<li class="active">
				<a href="${rc.contextPath}/admin/index" data-togggle="tab">首页</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/enterprise_manage" data-togggle="tab">企业管理及审核</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/forum_manage" data-togggle="tab">论坛管理</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/message" data-togggle="tab">消息</a>
			</li>
			<li class="pull-right">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown">
					<img src="${rc.contextPath}/img/leader_default.png" width="20px" />管理员<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li>
						<a href="#">账号设置</a>
					</li>
					<li>
						<a href="${rc.contextPath}/admin/logout">退出</a>
					</li>
				</ul>
			</li>
		</ul>

		<div style="margin-top: 20px;" class="col-xs-2">
			<nav class="menu" data-toggle="menu" style="width: 200px;">
				<ul class="nav nav-primary">

					<li class="active show nav-parent">
						<a href="javascript:;"><i class="icon icon-book"></i> 校园公告管理</a>
						<ul class="nav">
							<li>
								<a href="${rc.contextPath}/admin/campus/list/1" ><i class="icon icon-list-ul"></i> 公告管理</a>
							</li>
							<li class="active">
								<a href="${rc.contextPath}/admin/campus/add" ><i class="icon icon-pencil"></i> 发布公告</a>
							</li>
						</ul>
					</li>
					<li>
						<a href="#"><i class="icon icon-picture"></i> 首页轮播管理</a>
					</li>
					
				</ul>
			</nav>
		</div>
		
		<div class="col-xs-8" style="margin-top: 20px;">
		<form action="${rc.contextPath}/admin/campus/add" onsubmit="getContent();" method="post" id="campusForm">
			<div class="panel">
				<div class="panel-heading">
					文章标题
				</div>
				<div class="panel-body">
					<div class="col-xs-2">
						<select name="news_type">
							<option value="0" #if($!news.news_type == 0) selected="selected" #end>通知公告</option>
							<option value="1" #if($!news.news_type == 1) selected="selected" #end>>就业指导</option>
						</select>
					</div>
					<div class="col-xs-10">
						<input type="text" class="form-control" name="news_title" value="$!news.news_title"/>
						<span>$!errorMsg</span>
					</div>
				</div>
			</div>
			
			<div class="panel">
				<div class="panel-heading">
					文章内容
				</div>
				<input type="hidden" id="newsid" name="id" value="$!news.id"/>
				<input type="hidden" name="detailId" value="$!news.detail.id"/>
				<input type="hidden" id="detail_content" name="detail_content" value='$!news.detail.detail_content'/>
				
			    <script id="editor" type="text/plain" style="height:500px;"></script>
			</div>
			
		
			
			
			<div align="center">
				<button type="submit" class="btn btn-primary" >发表</button>
			</div>
		</form>
		</div>
	
</body>

		<script type="text/javascript">
			//实例化编辑器
	    	//建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
	   		 var ue = UE.getEditor('editor');
		
			$(document).ready(function(){
				
				//在ueditor实例化创建好写入内容
				
				ue.addListener("ready",function(){
					var newsctt=$("#detail_content").val();
			        UE.getEditor('editor').setContent(newsctt);
				});
				
				var newsid = $("#newsid").val();
				if(newsid!=null&&newsid!=""){
					$("#campusForm").attr("action","${rc.contextPath}/admin/campus/edit")
				}
				
			});
			
		    function getContent(){
		    	$("#detail_content").val(ue.getContent());
		    }
	    </script>
</html>